package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.stereotype.Controller;

import com.zr.service.UpdateGuoFanPriceService;
@Controller
public class UpdateGuoFanPriceAction implements ServletResponseAware{
	private HttpServletResponse resp;
	private int disid;
	private double fkgc;
	private double subkilogramme;
	private double mtm;
	
	public int getDisid() {
		return disid;
	}

	public void setDisid(int disid) {
		this.disid = disid;
	}

	public double getFkgc() {
		return fkgc;
	}

	public void setFkgc(double fkgc) {
		this.fkgc = fkgc;
	}

	public double getSubkilogramme() {
		return subkilogramme;
	}

	public void setSubkilogramme(double subkilogramme) {
		this.subkilogramme = subkilogramme;
	}

	public double getMtm() {
		return mtm;
	}

	public void setMtm(double mtm) {
		this.mtm = mtm;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		this.resp=arg0;
		
	}
	@Resource
	private UpdateGuoFanPriceService upgfpserim;
	
	public void updateGuoFanPrice(){
		resp.setCharacterEncoding("utf8");
		try {
			PrintWriter pw=resp.getWriter();
			upgfpserim.updateFanPrice(disid, fkgc, subkilogramme, mtm);
			pw.write("1");
			pw.flush();
			pw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
